﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace skydream
{
    public class RunFileHelp
    {
       
        /// <summary>
        /// 打开一个外部文件
        /// </summary>
        /// <param name="f">文件的名字和地址</param>
        public static void RunFile(string f)//打开一个外部文件
        {

            //声明一个程序类
            System.Diagnostics.Process p;
            try
            {
                //
                //启动外部程序
                //
                //Proc = System.Diagnostics.Process.Start(f);

                
               p = new System.Diagnostics.Process();
                p.StartInfo.UseShellExecute = true;
                p.StartInfo.FileName = f;
                p.Start();
            }
            catch (System.ComponentModel.Win32Exception)
            {
                //Console.WriteLine("系统找不到指定的程序文件。\r{0}", e);
                return;
            }


        }
        /// <summary>
        /// 打开指定网页
        /// </summary>
        /// <param name="command">ie的固定网址</param>
        public static void RunIE(string command)//打开指定网页
        {
            Process myProcess = new Process();
            myProcess.StartInfo.FileName = "iexplore.exe";
            myProcess.StartInfo.Arguments = command;
            myProcess.Start();
            return;

        }
        /// <summary>
        /// //打开其他程序
        /// </summary>
        /// <param name="name"></param>
        /// <param name="command"></param>
        public static void RunOther(string name, string command)//打开其他程序
        {
            Process myProcess = new Process();

            myProcess.StartInfo.FileName = name;
            myProcess.StartInfo.Arguments = command;
            myProcess.Start();
            return;

        }
    }
}
